package cn.wit.summit.chwan.net;

import android.content.Context;

import com.google.gson.Gson;
import com.meituan.android.walle.WalleChannelReader;
import com.umeng.commonsdk.UMConfigure;

import java.util.HashMap;
import java.util.Map;

import cn.wit.summit.chwan.models.request.AddPraiseRequest;
import cn.wit.summit.chwan.models.request.CollectionIndexRequest;
import cn.wit.summit.chwan.models.request.CreateCommentRequest;
import cn.wit.summit.chwan.models.request.DailyNewRequest;
import cn.wit.summit.chwan.models.request.DeleteCommentRequest;
import cn.wit.summit.chwan.models.request.DiscoveryChoiceListRequest;
import cn.wit.summit.chwan.models.request.EditCommentRequest;
import cn.wit.summit.chwan.models.request.GetCommentDetailRequest;
import cn.wit.summit.chwan.models.request.GetCommentTokenRequest;
import cn.wit.summit.chwan.models.request.GetGameCommentRequest;
import cn.wit.summit.chwan.models.request.TopicInfoRequest;
import cn.wit.summit.chwan.models.request.TopicListRequest;
import cn.wit.summit.chwan.net.okhttplib.HttpInfo;
import cn.wit.summit.chwan.utils.AESUtils;
import cn.wit.summit.chwan.utils.GetPhoneAddressUtil;
import cn.wit.summit.chwan.utils.LogUtils;
import cn.wit.summit.chwan.utils.MD5Util;
import cn.wit.summit.chwan.utils.MetaUtils;
import cn.wit.summit.chwan.utils.StringToUnicodeUtil;
import cn.wit.summit.chwan.utils.StringUtils;
import cn.wit.summit.chwan.utils.SystemInfoUtils;

/**
 * Created by Alan on 2018/3/8.
 */

public class BuildRequestUtils {

    private  String adId;
    private String deviceId;
    private String umengId;
    private String version;
    private String token;
    private String mac;
    private String ip_address;
    private String channel_num;
    private String mobile_phone_model;
    private String imei;

    private static BuildRequestUtils buildRequestUtils;

    private Gson gson;

    private Map<String, String> header = new HashMap<>();
    private Map<String, String> header2 = new HashMap<>();
    private Map<String, String> header3 = new HashMap<>();

    private Context context;

    public BuildRequestUtils(Context context) {
        this.context = context;
        gson = new Gson();
        imei = SystemInfoUtils.getInstance(context).getIMEI();
        deviceId = SystemInfoUtils.getInstance(context).getDeviceId();
        umengId = UMConfigure.getUMIDString(context);
        version = SystemInfoUtils.getInstance(context).getVersionName();

        String temp = creatRamNum(0) + '|' + version + '|' + creatRamNum(1)
                + '|' + deviceId + '|' + creatRamNum(3);
        String access_token = AESUtils.keyEncrypt(temp);

        String md5String = deviceId + "gzRN53VWRF9BYUXo" + "mg2014";
        token = MD5Util.stringToMD5(md5String);
        channel_num = MetaUtils.getAd(context);
        mobile_phone_model = android.os.Build.MODEL;
        mac = GetPhoneAddressUtil.getAdresseMAC(context);
//        ip_address = GetPhoneAddressUtil.getNetIp();
        try {
            adId= WalleChannelReader.get(context,"adId");
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (StringUtils.isEmpty(adId)){
            adId="0";
        }
        if (umengId==null || StringUtils.isEmpty(umengId)) {
            umengId = "null";
        }

        header.put("Content-Type", "application/json; charset=UTF-8");
        header.put("version", version);
        header.put("device-id", deviceId);
        header.put("Unique-Code", umengId);
        header.put("access-token", access_token);
        header.put("imei", imei);
        header.put("adId",adId);
        header.put("ChaoHuiWan-App-Interal-Tags", "Salem501200");//请求标识

        header2.put("Content-Type", "application/x-www-form-urlencoded");
        header2.put("version", version);
        header2.put("device-id", deviceId);
        header2.put("Unique-Code", umengId);
        header2.put("access-token", access_token);
        header2.put("imei", imei);
        header2.put("adId",adId);
        header2.put("ChaoHuiWan-App-Interal-Tags", "Salem501200");//请求标识

        header3.put("adId",adId);
        header3.put("Content-Type", "application/json");
        header3.put("X-WuFan-APP-ID", "yiqiwan-app");
        header3.put("imei", imei);
    }

    private String creatRamNum(int m) {
        int num = (int) (Math.random() * 101);//0~100随机数
        return String.valueOf(num + (m * 100));
    }

    public static BuildRequestUtils getInstance(Context context) {
        if (buildRequestUtils == null) buildRequestUtils = new BuildRequestUtils(context);
        return buildRequestUtils;
    }

    private void serHeader() {
        imei = SystemInfoUtils.getInstance(context).getIMEI();
        header.put("imei", imei);
        header2.put("imei", imei);
        header3.put("imei", imei);
    }

    private HttpInfo getHttpInfo(String url, String temp) {
        if (StringUtils.isEmpty(imei))
            serHeader();
        return HttpInfo.Builder().addHeads(header).setUrl(url).addParamJson(temp).setNeedResponse(false).build();
    }

    private HttpInfo getLoginHttpInfo(String url, String temp) {
        if (StringUtils.isEmpty(imei))
            serHeader();
        return HttpInfo.Builder().addHeads(header2).setUrl(url).addParamForm(temp).setNeedResponse(false).build();
    }
    private HttpInfo getDataMqsHttpInfo(String url, String temp) {
        if (StringUtils.isEmpty(imei))
            serHeader();
        return HttpInfo.Builder().addHeads(header3).setUrl(url).addParamForm(temp).setNeedResponse(false).build();
    }

    private HttpInfo getLoginHttpInfo(String url, Map map) {
        if (StringUtils.isEmpty(imei))
            serHeader();
        HttpInfo.Builder builder = HttpInfo.Builder().addHeads(header2).setUrl(url);
        builder.addParams(map);
        return builder.setNeedResponse(false).build();
    }

    private HttpInfo getUploadHttpInfo(String url, Map map, String filepath) {
        if (StringUtils.isEmpty(imei))
            serHeader();
        HttpInfo.Builder builder = HttpInfo.Builder().addHeads(header2).setUrl(url);
        builder.addUploadFile("files", filepath);
        builder.addParams(map);
        return builder.setNeedResponse(false).build();
    }

    private HttpInfo getHttpInfo(String url) {
        if (StringUtils.isEmpty(imei))
            serHeader();
        return HttpInfo.Builder().addHeads(header).setUrl(url).setNeedResponse(false).build();
    }


    //推荐首页
    public HttpInfo getIndexData(int pn) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("pn", pn+"");
        return getHttpInfo(RpcConstant.indexData, gson.toJson(tempMap));
    }

    //搜索——auto
    public HttpInfo getAutoSearch(String key_word) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("key_word", key_word);
        return getHttpInfo(RpcConstant.getAutoSearch, gson.toJson(tempMap));
    }

    //搜索
    public HttpInfo getSearch(String key_word, int pn, int tag_id) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("key_word", key_word);
        tempMap.put("pn", pn+"");
        if (tag_id!=0)
            tempMap.put("tag_id", tag_id+"");
        return getHttpInfo(RpcConstant.getResultSearch, gson.toJson(tempMap));
    }

    //账号密码 登录
    public HttpInfo getAccountLogin(String mobile, String pwd) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("mobile", mobile);
        tempMap.put("passwd", pwd);
        return getLoginHttpInfo(RpcConstant.getLogin, tempMap);
    }
    //发送用户系统消息
    public HttpInfo getUserStsten(String uid, String token,String p) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid);
        tempMap.put("token", token);
        tempMap.put("i", p);
        return getLoginHttpInfo(RpcConstant.getUserSysten, tempMap);
    }

    //获取红包
    public HttpInfo getRedBnvelope(int uid, String token) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid + "");
        tempMap.put("token", token);
        return getLoginHttpInfo(RpcConstant.getRedBnvelope, tempMap);
    }

    //修改昵称
    public HttpInfo getChangeName(String name, String uid, String token) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("nickname", name);
        tempMap.put("uid", uid);
        tempMap.put("token", token);
        return getLoginHttpInfo(RpcConstant.getChangeName, tempMap);
    }

    //检查token并更新数据
    public HttpInfo checkToken(int uid, String token) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid + "");
        tempMap.put("token", token);
        return getLoginHttpInfo(RpcConstant.checkToken, tempMap);
    }

    //修改头像
    public HttpInfo getChangeIcon(String filepath, String uid, String token) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("files", filepath);
        tempMap.put("uid", uid);
        tempMap.put("token", token);
        return getUploadHttpInfo(RpcConstant.getChangeIcon, tempMap, filepath);
    }
    //修改头像
//    public HttpInfo getUploadData(String url, String uid,String token) {
//        Map<String, String> tempMap = new HashMap<>();
//        tempMap.put("files", url);
//        tempMap.put("uid", uid);
//        tempMap.put("token", token);
//        return getLoginHttpInfo(RpcConstant.getUploadData, tempMap);
//    }


    //获取修改密码验证码
    public HttpInfo getChangePwdCode(String mobile) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("mobile", mobile);
        tempMap.put("type", "passwd");
        return getLoginHttpInfo(RpcConstant.getCode, tempMap);
    }
    //获取登录验证码
    public HttpInfo getMobileCode(String mobile) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("mobile", mobile);
        tempMap.put("type", "reg");
//        return getLoginHttpInfo(RpcConstant.getCode, tempMap.toString().replace("{", "").replace("}", ""));
        return getLoginHttpInfo(RpcConstant.getCode, tempMap);
    }

    //验证码登录
    public HttpInfo getCodeLogin(String mobile, String code,String shareCode) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("mobile", mobile);
        tempMap.put("code", code);
        tempMap.put("shareCode", shareCode);

        return getLoginHttpInfo(RpcConstant.getCodeLogin, tempMap);
    }

    //设置密码
    public HttpInfo getNewPwd(String pwd, String code, String uid, String token) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("passwd", pwd);
        tempMap.put("code", code);
        tempMap.put("uid", uid);
        tempMap.put("token", token);
        return getLoginHttpInfo(RpcConstant.getChangePwd, tempMap);
    }

    //每日发现
    public HttpInfo getDailyDiscover(int pn, int pc) {
        DailyNewRequest temp = new DailyNewRequest(pn, pc);
        return getHttpInfo(RpcConstant.dailyDiscoverIndex, gson.toJson(temp));
    }

    //每日上新
    public HttpInfo getDailyNew(int pn, int pc) {
        DailyNewRequest temp = new DailyNewRequest(pn, pc);
        return getHttpInfo(RpcConstant.dailyNewIndex, gson.toJson(temp));
    }

    //专题列表
    public HttpInfo getThematicList(String merge_topic_id, int pn, int pc) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("merge_topic_id", merge_topic_id);
        tempMap.put("pn", pn+"");
        tempMap.put("pc", pc+"");
        return getHttpInfo(RpcConstant.thematicList, gson.toJson(tempMap));
    }

    //获取点评token
    public HttpInfo getCommentToken() {
        GetCommentTokenRequest temp = new GetCommentTokenRequest(token, version, deviceId, mac, ip_address, channel_num, mobile_phone_model);
        return getHttpInfo(RpcConstant.getCommentToken, gson.toJson(temp));
    }

    //修改点评
    public HttpInfo editComment(String commentToken, String gameId, String uid, String userToken, String content, String comment_id) {
        content = StringToUnicodeUtil.stringToUnicode(content);
        GetCommentTokenRequest te = new GetCommentTokenRequest(commentToken, version, deviceId, mac, ip_address, channel_num, mobile_phone_model);
        EditCommentRequest temp = new EditCommentRequest(te, gameId, uid, comment_id, userToken, content, creatRamNum(1), "");
        return getHttpInfo(RpcConstant.modifyComment, gson.toJson(temp).replace("\\\\", "\\"));
    }

    //创建点评
    public HttpInfo createComment(String commentToken, String gameId, String uid, String userToken, String head_portrait
            , String user_name, String content) {
//        content = StringToUnicodeUtil.stringToUnicode(content);
        return replayComment(commentToken, gameId, uid, userToken, head_portrait, user_name
                , content, "", "", ""
                , -1, "", -1);
    }

    //回复点评
    public HttpInfo replayComment(String commentToken, String gameId, String uid, String userToken, String head_portrait, String user_name
            , String content, String reply_comment_id, String reply_comment_user_name, String reply_comment_user_id
            , int position, String details_comment_id, int pn) {
        content = StringToUnicodeUtil.stringToUnicode(content);
        GetCommentTokenRequest te = new GetCommentTokenRequest(commentToken, version, deviceId, mac, ip_address, channel_num, mobile_phone_model);
        CreateCommentRequest temp = new CreateCommentRequest(te, gameId, uid, userToken, head_portrait, user_name
                , creatRamNum(1), content, reply_comment_id, reply_comment_user_name, reply_comment_user_id, position, details_comment_id
                , pn, "0");
        return getHttpInfo(RpcConstant.createComment, gson.toJson(temp).replace("\\\\", "\\"));
    }

    //点赞
    public HttpInfo addPraise(String commentToken, String gameId, int uid, String userToken, String comment_id, int type, int pn) {
        GetCommentTokenRequest te = new GetCommentTokenRequest(commentToken, version, deviceId, mac, ip_address, channel_num, mobile_phone_model);
        AddPraiseRequest temp = new AddPraiseRequest(te, gameId, uid, comment_id, userToken, type, pn);
        return getHttpInfo(RpcConstant.addPraise, gson.toJson(temp));
    }

    //点踩
    public HttpInfo unPraise(String commentToken, String gameId, int uid, String userToken, String comment_id, int type, int pn) {
        GetCommentTokenRequest te = new GetCommentTokenRequest(commentToken, version, deviceId, mac, ip_address, channel_num, mobile_phone_model);
        AddPraiseRequest temp = new AddPraiseRequest(te, gameId, uid, comment_id, userToken, type, pn);
        return getHttpInfo(RpcConstant.unPraise, gson.toJson(temp));
    }

    //点踩
    public HttpInfo deleteComment(String commentToken, String gameId, int uid, String userToken, String comment_id, int pn) {
        GetCommentTokenRequest te = new GetCommentTokenRequest(commentToken, version, deviceId, mac, ip_address, channel_num, mobile_phone_model);
        DeleteCommentRequest temp = new DeleteCommentRequest(te, comment_id, gameId, uid, userToken, pn);
        return getHttpInfo(RpcConstant.deleteComment, gson.toJson(temp));
    }

    //游戏详情点评列表
    public GetGameCommentRequest getGameComments(String commentToken, String gameId, int uid, int pn, int pc) {
        GetCommentTokenRequest te = new GetCommentTokenRequest(commentToken, version, deviceId, mac, ip_address, channel_num, mobile_phone_model);
        return new GetGameCommentRequest(te, gameId, uid, pn, pc);
    }

    //游戏详情点评列表
    public String getGameCommentsJsonStr(String commentToken, String gameId, int uid, int pn, int pc) {
        GetCommentTokenRequest te = new GetCommentTokenRequest(commentToken, version, deviceId, mac, ip_address, channel_num, mobile_phone_model);
        GetGameCommentRequest temp = new GetGameCommentRequest(te, gameId, uid, pn, pc);
        return gson.toJson(temp);
    }

    //点评详情
    public HttpInfo getCommentDetail(String commentToken, String gameId, String commentId, int uid, int pn, int pc, String sort) {
        GetCommentTokenRequest te = new GetCommentTokenRequest(commentToken, version, deviceId, mac, ip_address, channel_num, mobile_phone_model);
        GetCommentDetailRequest temp = new GetCommentDetailRequest(te, gameId, commentId, uid, pn, pc, sort);
        return getHttpInfo(RpcConstant.getCommentDetail, gson.toJson(temp));
    }

    //详情点评
    public HttpInfo getGameDetailComment(String commentToken, String gameId, int uid) {
        GetCommentTokenRequest te = new GetCommentTokenRequest(commentToken, version, deviceId, mac, ip_address, channel_num, mobile_phone_model);
        GetGameCommentRequest temp = new GetGameCommentRequest(te, gameId, uid, 1, 20);
        return getHttpInfo(RpcConstant.gamedetialCommentListHot, gson.toJson(temp));
    }

    //游戏首发
    public HttpInfo getGameNew(int pn, int pc) {
        DailyNewRequest temp = new DailyNewRequest(pn, pc);
        return getHttpInfo(RpcConstant.gameNewIndex, gson.toJson(temp));
    }

    //游戏库首页
    public HttpInfo getDiscoverIndex(int pn, int pc) {
        TopicListRequest temp = null;
        String url = RpcConstant.getDiscoverIndex;
        temp = new TopicListRequest(0, pn, pc);
        return getHttpInfo(url, gson.toJson(temp));
    }

    //专题列表
    public HttpInfo getTopicList(int belongTypeId, int pn, int pc) {
        TopicListRequest temp = null;
        String url = RpcConstant.getTopicList;
        temp = new TopicListRequest(belongTypeId, pn, pc);
        return getHttpInfo(url, gson.toJson(temp));
    }

    //专题详情
    public HttpInfo getTopicInfo(String topic_id, int pn, int pc) {
        TopicInfoRequest temp = null;
        String url = RpcConstant.getTopicInfo;
        temp = new TopicInfoRequest(topic_id, pn, pc);
        return getHttpInfo(url, gson.toJson(temp));
    }

    //合集
    public HttpInfo getCollectionIndex(String collection_id, int pn, int pc) {
        CollectionIndexRequest temp = null;
        String url = RpcConstant.getCollectionIndex;
        temp = new CollectionIndexRequest(collection_id, pn, pc);
        return getHttpInfo(url, gson.toJson(temp));
    }

    //游戏详情
    public HttpInfo getGameDetialData(String gameId,int uid) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("game_id", gameId);
        tempMap.put("uid", uid+"");
        return getHttpInfo(RpcConstant.getGameDetailInfo, gson.toJson(tempMap));
    }

    //游戏详情
    public HttpInfo sendGameData(String json) {
        return getDataMqsHttpInfo(RpcConstant.dataMqsUrl, json);
    }

    //发现-精选列表接口
    public HttpInfo getDiscoverChiceList(int type, int sort_type, int tag_type, int game_type, int pn, int pc) {
        String url = RpcConstant.getChoiceList;
        DiscoveryChoiceListRequest temp = new DiscoveryChoiceListRequest(type, sort_type, tag_type, game_type, pn, pc);
        return getHttpInfo(url, gson.toJson(temp));
    }

    public HttpInfo getGameListIndex(int game_type, int sort_type, int tag_type, int pn, int pc) {
        String url = RpcConstant.getGameTList;
        DiscoveryChoiceListRequest temp = new DiscoveryChoiceListRequest(game_type, sort_type, tag_type, pn, pc);
        return getHttpInfo(url, gson.toJson(temp));
    }

    public HttpInfo getHotNewGameList(int type, int sort_type, int tag_type, int game_type, int pn, int pc) {
        String url;
        HttpInfo info;
        if (type == 6)//google
        {
            url = RpcConstant.getRankingByGgArea;
            DiscoveryChoiceListRequest temp = new DiscoveryChoiceListRequest(sort_type, tag_type, pn, pc);
            info = getHttpInfo(url, gson.toJson(temp));
        } else if (type == 5)//apple
        {
            url = RpcConstant.getGameListByAppleArea;
            DiscoveryChoiceListRequest temp = new DiscoveryChoiceListRequest(type, sort_type, tag_type, game_type, pn, pc);
            info = getHttpInfo(url, gson.toJson(temp));
        } else {
            url = RpcConstant.getGameListByArea;
            DiscoveryChoiceListRequest temp = new DiscoveryChoiceListRequest(type, sort_type, tag_type, game_type, pn, pc);
            info = getHttpInfo(url, gson.toJson(temp));
        }
        return info;
    }

    //类型、标签、分类接口
    public HttpInfo getGameTypeList() {
        return getHttpInfo(RpcConstant.getGameTypeList, "");
    }

    //其他相关游戏
    public HttpInfo getGameOtherGame(String gameId) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("game_id", gameId);
        return getHttpInfo(RpcConstant.getGameOtherGame, gson.toJson(tempMap));
    }

    //其他相关游戏
    public HttpInfo getAllGameVersion(String gameIds) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("package_name", gameIds);
        return getHttpInfo(RpcConstant.getUpdateGames, gson.toJson(tempMap));
    }
    //其他相关游戏
    public HttpInfo getbackAllGameVersion(String gameIds) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("package_name", gameIds);
        return getHttpInfo(RpcConstant.getbackgames, gson.toJson(tempMap));
    }

    //其他相关游戏
    public HttpInfo getPersonData(String gameIds) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("package_name", gameIds);
        return getHttpInfo(RpcConstant.getPersonData, gson.toJson(tempMap));
    }

    //搜藏游戏
    public HttpInfo followGame(String game_id, String uid, String token) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid);
        tempMap.put("game_id", game_id);
        tempMap.put("token", token);
        return getHttpInfo(RpcConstant.getGameFollow, gson.toJson(tempMap));
    }

    //获取搜藏的游戏
    public HttpInfo getFollowGames(String uid,String token, String pn) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid);
        tempMap.put("pn", pn);
        tempMap.put("token", token);
        return getHttpInfo(RpcConstant.getGameFollowGames, gson.toJson(tempMap));
    }

    //取消搜藏的游戏
    public HttpInfo getCancleFollowGame(String gameid, String uid, String token) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid);
        tempMap.put("game_id", gameid);
        tempMap.put("token", token);
        return getHttpInfo(RpcConstant.getCancleGameFollowGame, gson.toJson(tempMap));
    }

    //许愿池
    public HttpInfo sendTreviGames(String uid, String account, String token, String game_name, String game_info) {
        game_name = StringToUnicodeUtil.stringToUnicode(game_name);
        game_info = StringToUnicodeUtil.stringToUnicode(game_info);
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid);
        tempMap.put("game_name", game_name);
        tempMap.put("game_info", game_info);
        tempMap.put("account", account);
        tempMap.put("token", token);
        return getHttpInfo(RpcConstant.sendMessage, gson.toJson(tempMap).replace("\\\\", "\\"));
    }

    //游戏详情热门游戏
    public HttpInfo gamedetialHotCommit(String game_id, String uid) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid);
        tempMap.put("game_id", game_id);
        return getHttpInfo(RpcConstant.getGameFollow, gson.toJson(tempMap));
    }

    //消息
    public HttpInfo gamenotificationData(String uid, String token, int pn) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid);
        tempMap.put("token", token);
        tempMap.put("pn", pn + "");
        return getLoginHttpInfo(RpcConstant.gamenotificationData, tempMap);
    }

    //点赞列表
    public HttpInfo getThumbsData(int uid, String token, int pn) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid + "");
        tempMap.put("token", token);
        tempMap.put("pn", pn + "");
        return getHttpInfo(RpcConstant.getThumbsData, gson.toJson(tempMap));
    }

    //点评回复
    public HttpInfo getNoticeCommitData(int uid, String token, int pn) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid + "");
        tempMap.put("token", token);
        tempMap.put("pn", pn + "");
        return getHttpInfo(RpcConstant.getNoticeCommitData, gson.toJson(tempMap));
    }

    //回复点评
    public HttpInfo getSurplusNumber(int uid, String token) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid + "");
        tempMap.put("token", token);
        return getHttpInfo(RpcConstant.getSurplusNumber, gson.toJson(tempMap));
    }

    //下载并安装
    public HttpInfo downEnnerGhy(int uid, String token, String transactionId) {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", uid + "");
        tempMap.put("token", token);
        tempMap.put("transactionId", transactionId);
        tempMap.put("type", "NewGame");
        return getLoginHttpInfo(RpcConstant.downEnnerGhy, tempMap);
    }
    //下载并安装
    public HttpInfo getPlug() {
        Map<String, String> tempMap = new HashMap<>();
        tempMap.put("uid", 0 + "");
        return getHttpInfo(RpcConstant.getCheckAppVersionAndPlug, gson.toJson(tempMap));
    }

}